<?php
defined( '_JEXEC' );
echo '<div class="componentheading">Scorecards</div>';

jimport('joomla.application.helper');
require_once( JApplicationHelper::getPath( 'html' ) );
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.
'components'.DS.$option.DS.'tables');
switch($task)
{
case 'view':
viewScorecards($option);
break;
default:
showPublishedScorecards($option);
break;
}
function showPublishedScorecards($option)
{
$db =& JFactory::getDBO();
$query = "SELECT * FROM #__statzone_scorecards WHERE
showplayer = '1'";
$db->setQuery( $query );
$rows = $db->loadObjectList();
if ($db->getErrorNum())
{
echo $db->stderr();
return false;
}
	HTML_scorecards::showScorecards($rows, $option);
}

function viewScorecard($option)
{
$id = JRequest::getVar('id', 0);
$row =& JTable::getInstance('statzone_scorecard', 'Table');
$row->load($id);
if(!$row->published)
{
JError::raiseError( 404, JText::_( 'Invalid
ID provided' ) );
}
HTML_reviews::showScorecard($row, $option);
}
?>